package com.yunkont.pigcontrol.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by ZJB on 2017/9/21.
 *
 * @ copyright: iwhere chengdu technology
 */

public class MainPagerAapter extends FragmentPagerAdapter{
    private List<Fragment> fragments;

    public MainPagerAapter(FragmentManager fm,List<Fragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments==null?0:fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        String[] titles = new String[]{"猪详情","查看历史","导出数据",""};

        return titles[position];
    }
}
